package com.mano.mall.service.mapper;

import com.mano.mall.service.mapper.entity.IntegralEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * 积分Mapper
 * 
 */
public interface IntegralMapper {
	@Insert("INSERT INTO `mano_integral` VALUES (NULL, #{userId}, #{paymentId},#{integral}, #{availability}, 0, null, now(), null, now());")
	public int insertIntegral(IntegralEntity integralEntity);

	@Select("SELECT  id as id ,USER_ID as userId, PAYMENT_ID as PAYMENTID ,INTEGRAL as INTEGRAL ,AVAILABILITY as AVAILABILITY  FROM mano_integral where PAYMENT_ID=#{paymentId}  AND AVAILABILITY='1';")
	public IntegralEntity findIntegral(String paymentId);

	@Delete("DELETE FROM mano_integral where id = #{id}")
	public int deleteIntegral(Integer id);
}
